home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / TinyGL / ami / content / ad709 / tinygl / src / zmath.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-08-15  |  968 b   |  55 lines

  1. #ifndef __ZMATH__
  2. #define __ZMATH__
  3.  
  4. /* Matrix & Vertex */
  5.  
  6.  
  7. typedef struct {
  8.     float m[4][4];
  9. } M4;
  10.  
  11. typedef struct {
  12.     float m[3][3];
  13. } M3;
  14.  
  15. typedef struct {
  16.     float m[3][4];
  17. } M34;
  18.  
  19.  
  20. #define X v[0]
  21. #define Y v[1]
  22. #define Z v[2]
  23. #define W v[3]
  24.  
  25. typedef struct {
  26.     float v[3];
  27. } V3;
  28.  
  29. typedef struct {
  30.     float v[4];
  31. } V4;
  32.  
  33. void gl_M4_Id(M4 *a);
  34. int gl_M4_IsId(M4 *a);
  35. void gl_M4_Move(M4 *a,M4 *b);
  36. void gl_MoveV3(V3 *a,V3 *b);
  37. void gl_MulM4V3(V3 *a,M4 *b,V3 *c);
  38. void gl_MulM3V3(V3 *a,M4 *b,V3 *c);
  39.  
  40. void gl_M4_MulV4(V4 * a,M4 *b,V4 * c);
  41. void gl_M4_InvOrtho(M4 *a,M4 b);
  42. void gl_M4_Inv(M4 *a,M4 *b);
  43. void gl_M4_Mul(M4 *c,M4 *a,M4 *b);
  44. void gl_M4_MulLeft(M4 *c,M4 *a);
  45. void gl_M4_Transpose(M4 *a,M4 *b);
  46. void gl_M4_Rotate(M4 *c,float t,int u);
  47. int  gl_V3_Norm(V3 *a);
  48. V3 gl_V3_New(float x,float y,float z);
  49. V4 gl_V4_New(float x,float y,float z,float w);
  50. int gl_Matrix_Inv(float *r,float *m,int n);
  51.  
  52.  
  53.  
  54. #endif  __ZMATH__
  55.